<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link href="/static/reasahi/css/daterangepicker.css" th:href="@{/reasahi/js/daterangepicker.css}" rel="stylesheet"/>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <form id="searchForm">
        <div class="btn-group hidden-xs" id="toolbar" role="group">
            <label id="userGoldCoin" type="button" class="btn btn-outline btn-default">
                金币奖励：0
            </label>
            <label id="userRedPacket" type="button" class="btn btn-outline btn-default">
                红包奖励：0
            </label>
            <label id="moneyCommissionGoldCoins" type="button" class="btn btn-outline btn-default">
                金币佣金：0
            </label>
            <label id="moneyCommissionRedEnvelope" type="button" class="btn btn-outline btn-default">
                红包佣金：0
            </label>
            <label id="moneyExtensionRedEnvelope" type="button" class="btn btn-outline btn-default">
                推广佣金：0
            </label>
            <label style="margin-left: 10px" type="button" class="btn btn-primary" onclick="resetForm()" id=""><i
                    class="fa fa-paper-plane"></i>&nbsp;重置
            </label>
            <button style="margin-left: 10px" type="button" class="btn btn-primary" onclick="search()" id=""><i
                    class="fa fa-search"></i>&nbsp;搜索
            </button>
        </div>
        <div class="btn-group hidden-xs" id="toolbar1" role="group">
            <div class="col-xs-3">
                <div class="input-group">
                    <div class="input-group-btn">
                        <button class="btn btn-white" type="button">用户ID</button>
                    </div>
                    <input type="text" class="form-control" id="usId" placeholder="用户ID">
                </div>
            </div>
            <div class="col-xs-3">
                <div class="input-group">
                    <div class="input-group-btn">
                        <button class="btn btn-white" type="button">用户名</button>
                    </div>
                    <input type="text" class="form-control" id="usNickname" placeholder="用户名">
                </div>
            </div>
            <div class="col-xs-3">
                <div class="input-group">
                    <div class="input-group-btn">
                        <button class="btn btn-white" type="button">徒弟ID</button>
                    </div>
                    <input type="text" class="form-control" id="pusId" placeholder="徒弟ID">
                </div>
            </div>
            <div class="col-xs-3">
                <div class="input-group">
                    <div class="input-group-btn">
                        <button class="btn btn-white" type="button">奖励类型</button>
                    </div>
                    <select class="form-control input-s-sm inline" id="rrType"
                            th:with="type=${@dictService.selectDictData('reward_type')}">
                        <option value="">请选择</option>
                        <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
                    </select>
                </div>
            </div>
            <div style="margin-top: 10px;" class="col-xs-3">
                <div class="input-group">
                    <div class="input-group-btn">
                        <button class="btn btn-white" type="button">奖励渠道</button>
                    </div>
                    <select class="form-control input-s-sm inline" id="rrSourceType"
                            th:with="type=${@dictService.selectDictData('reward_channel')}">
                        <option value="">请选择</option>
                        <option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
                    </select>
                </div>
            </div>
            <div style="margin-top: 10px;width: 35%; margin-left: -16px;" class="col-xs-3">
                <div class="col-sm-9">
                    <div class="form-group">
                        <div class="input-group date">
                            <span class="input-group-addon">创建时间</span>
                            <input id="createTime" name="datePickerdatePicker" type="text" class="form-control"
                                   value="">
                            <span class="input-group-addon" onclick="clearInput()"><i class="fa fa-remove"></i></span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <table class="bootstrap-table" data-mobile-responsive="true">
    </table>
</div>
<div th:include="include :: footer"></div>
<script src="/static/reasahi/js/ry-table.js?v=1.1.6" th:src="@{/reasahi/js/ry-table.js?v=1.1.6}"></script>
<script src="/js/jquery-ui-1.10..min.js" th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
<script src="/static/reasahi/js/moment.js?v1.1.6" th:src="@{/reasahi/js/moment.js?v=1.1.6}"></script>
<script src="/static/reasahi/js/daterangepicker.js?v1.1.6" th:src="@{/reasahi/js/daterangepicker.js?v=1.1.6}"></script>
<script src="/reasahi/manage/rewardRecord/rewardRecord.js"
        th:src="@{/reasahi/manage/rewardRecord/rewardRecord.js}"></script>
<script th:inline="javascript">
    var editFlag = [[${@permissionService.hasPermi('manage:rewardRecord:edit')}]];
    var removeFlag = [[${@permissionService.hasPermi('manage:rewardRecord:remove')}]];
    var userId = sessionStorage.getItem("userId");
    if (userId) {
        $("#usId").val(userId);
        $("#usId").prop('disabled', true);
    }
    var startCreatTime = moment().hours(0).minutes(0).seconds(0);
    startCreatTime = startCreatTime.format('YYYY-MM-DD HH:mm:ss');
    var endTime = moment().hours(23).minutes(59).seconds(59);
    endTime = endTime.format('YYYY-MM-DD HH:mm:ss');
    $('input[name="datePickerdatePicker"]').daterangepicker({
            // timePicker: false, //显示时间
            // timePicker24Hour: false, //时间制
            // timePickerSeconds: false, //时间显示到秒
            startDate: moment().hours(0).minutes(0).seconds(0), //设置开始日期
            endDate: moment(new Date()), //设置结束器日期
            maxDate: moment(new Date()), //设置最大日期
            "opens": "center", ranges: {
                '今天': [moment(), moment()],
                '昨天': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                '上周': [moment().subtract(6, 'days'), moment()],
                '前30天': [moment().subtract(29, 'days'), moment()],
                '本月': [moment().startOf('month'), moment().endOf('month')],
                '上月': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
            },
            showWeekNumbers: true, locale: {
                format: "YYYY-MM-DD", //设置显示格式
                applyLabel: '确定', //确定按钮文本
                cancelLabel: '取消', //取消按钮文本
                customRangeLabel: '自定义',
                daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                firstDay: 1
            },
        },
        function (start, end, label) {
            var timeRangeChange = [start.format('YYYY-MM-DD HH:mm:ss'), end.format('YYYY-MM-DD HH:mm:ss')];
            console.log(timeRangeChange);
            startCreatTime = start.format('YYYY-MM-DD HH:mm:ss');
            endTime = end.format('YYYY-MM-DD HH:mm:ss');
        });


    function clearInput() {
        $('#createTime').val('');
        console.log(startCreatTime);
        console.log(endTime);
    }

    function resetForm() {
        cmResetForm();
        search();
        var userId = sessionStorage.getItem("userId");
        if (userId) {
            $("#usId").val(userId);
        }
    }
</script>
</body>
</html>